package com.qcc.week13;

import com.qcc.week13.demo.KafkaDemo;
import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Week13Application {

    public static void main(String[] args) {
        String servers = "localhost:9092,localhost:9093,localhost:9094";
        String topic = "TestTopic";
        String message = "test";

        KafkaProducer<String, String> producer = KafkaDemo.createProducer(servers);
        KafkaDemo.send(producer, topic, message);

        KafkaConsumer<String, String> consumer = KafkaDemo.createConsumer(servers, topic);
        KafkaDemo.readMessage(consumer, 100);
        SpringApplication.run(Week13Application.class, args);
    }

}
